package com.lxq.controller;

import com.lxq.model.Person;
import com.lxq.service.PersonService;
import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class PersonAction extends  ActionSupport{
    private PersonService personService;

    public  String searcha() throws  Exception{
        System.out.println("123");
        List<Person> list = personService.search();
        System.out.println(list);
        HttpServletRequest request = ServletActionContext.getRequest();
        request.setAttribute("list", list);
        return  "success";
    }
        public  String addper(){
            System.out.println("begin");
        Person p=new Person("lss","jkl",22);
        personService.addPerson(p);
            System.out.println("end");
            return "yes";
        }
    public PersonService getPersonService() {
        return personService;
    }

    public void setPersonService(PersonService personService) {
        this.personService = personService;
    }
}
